package com.ldodds.ot;

import java.util.HashMap;
import java.util.Map;

/**
 * Implementation of the PropertyHolder interface.
 * 
 * @author Leigh Dodds
 */
public class PropertyHolderImpl implements PropertyHolder {

	private Map<String, Object> propertiesByKey;
	private Map<String, Object> propertiesByURI;
	
	public PropertyHolderImpl() {
		propertiesByKey = new HashMap<String,Object>();
		propertiesByURI = new HashMap<String,Object>();
	}
	
	@Override
	public Map<String, Object> getProperties() {
		return propertiesByKey;
	}

	@Override
	public Map<String, Object> getPropertiesByURI() {
		return propertiesByURI;
	}

	@Override
	public void put(String uri, String key, Object value) {
		propertiesByKey.put(key, value);
		propertiesByURI.put(uri, value);
	}

	public boolean hasProperty(String propertyURI) {
		return propertiesByURI.containsKey(propertyURI);
	}
}
